﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Cotrobaie.UsersWebService;

namespace Cotrobaie
{
    public partial class EmailVerif : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] != null)
                Response.Redirect("~/Home.aspx");//sunt deja logat, nu am ce cauta aici
            if (Request.QueryString["ActivationCode"] == null)
                Response.Redirect("~/Home.aspx");//Nu am cod

            ParseQueryString();
        }
        private void ParseQueryString()
        {
            using (UsersSoapClient serviciu = new UsersSoapClient("UsersSoap"))
            {
                var result = serviciu.ActivareCont(Request.QueryString["ActivationCode"].ToString());
                RegisterOkText.InnerHtml = result.Mesaj;
                if (result.Success) { RegisterOk.Src = "images/oksmall.png"; RegisterOk.Alt = "Ok"; }
                else { RegisterOk.Src = "images/nooksmall.png"; RegisterOk.Alt = "No"; }
            }
        }

        protected void goHome(object sender, EventArgs e)
        {
            Response.Redirect("~/Home.aspx");
        }
    }
}